<!DOCTYPE html>
<html>
<head>
<title>飞雷运营中心</title>
<link rel="stylesheet" href="statics/css/login.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="App Loction Form,Login Forms,Sign up Forms,Registration Forms,News latter Forms,Elements"./>
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
</script>
<!--webfonts-->
<!--//webfonts-->
</head>
<body>
		<div style="margin-top: 50px;" class="app-location" id="rrapp" v-cloak>
			<h2>飞雷运营中心</h2>
			<div class="line"><span></span></div>
			<div class=""><img style="height: 100px;" src="statics/img/location.png" class="img-responsive" alt="" /></div>
			<div v-if="error" class="alert alert-danger alert-dismissible">
		        <h4 style="margin-bottom: 0px;color:#fff"><i class="fa fa-exclamation-triangle"></i> {{errorMsg}}</h4>
		    </div>
			<form>
				<input type="text" class="text" v-model="username" placeholder="账号" >
				<input type="password" v-model="password" placeholder="密码">
				<input type="text" v-model="captcha" @keyup.enter="login" placeholder="验证码">
				<div class="form-group has-feedback" style="height: 60px;margin: 0.7em 1.6em;line-height: 60px;min-width: 290px;">
			        <img alt="如果看不清楚，请单击图片刷新！" style="float: left;padding-top: 5px;" class="pointer" :src="src" @click="refreshCode">
			        &nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:;" style="color: #fff;" @click="refreshCode">点击刷新</a>
			    </div>
				<div class="login" @click="login">登陆</div>
				<div class="clear"></div>
				<div class="new">
					<h3><a href="#">忘记密码 ?</a></h3>
					<h4><a href="#">注册</a></h4>
					<div class="clear"></div>
				</div>
			</form>
		</div>
	<!--start-copyright-->
   		<div class="copy-right">
				<p>Copyright &copy; 2015.Company name All rights reserved <a href="http://www.flyray.me/" target="_blank" title="飞雷">飞雷</a> - Collect from <a href="http://www.flyray.me/" title="飞雷" target="_blank">飞雷</a></p>
		</div>
	<!--//end-copyright-->
</body>
<script src="statics/libs/jquery.min.js"></script>
<script src="statics/libs/vue.min.js"></script>
<script src="statics/libs/bootstrap.min.js"></script>
<script src="statics/libs/jquery.slimscroll.min.js"></script>
<script src="statics/libs/fastclick.min.js"></script>
<script src="statics/libs/app.js"></script>
<script type="text/javascript">
var vm = new Vue({
	el:'#rrapp',
	data:{
		username: '',
		password: '',
		captcha: '',
		error: false,
		errorMsg: '',
		src: 'captcha.jpg'
	},
	beforeCreate: function(){
		if(self != top){
			top.location.href = self.location.href;
		}
	},
	methods: {
		refreshCode: function(){
			this.src = "captcha.jpg?t=" + $.now();
		},
		login: function (event) {
			var data = "username="+vm.username+"&password="+vm.password+"&captcha="+vm.captcha;
			$.ajax({
				type: "POST",
			    url: "sys/login",
			    data: data,
			    dataType: "json",
			    success: function(result){
					if(result.code == 0){//登录成功
						parent.location.href ='index.html';
					}else{
						vm.error = true;
						vm.errorMsg = result.msg;
						
						vm.refreshCode();
					}
				}
			});
		}
	}
});
</script>
</html>